package leetcode_1601_1700;

import java.util.Arrays;
import java.util.Comparator;

public class LeeCode_1637 {
    public static void main(String[] args) {
        System.out.println(maxWidthOfVerticalArea(new int[][]{{8, 7}, {9, 9}, {7, 4}, {9, 7}}));
        System.out.println(maxWidthOfVerticalArea(new int[][]{{3, 1}, {9, 0}, {1, 0}, {1, 4},{5,3},{8,8}}));
    }
    private static int maxWidthOfVerticalArea(int[][] points) {
        int ans = 0;
        Arrays.sort(points, Comparator.comparingInt(o -> o[0]));
        for (int i = 1; i < points.length; i++) {
            ans = Math.max(points[i][0] - points[i - 1][0], ans);
        }
        return ans;
    }
}
